﻿@page "/Detail/{ID}"
@using WorkFlow.Data
@using WorkFlow.Data.Model
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
@inject ProtectedSessionStorage ProtectedSessionStore
@inject List<WorkFlowDetail> workFlowDetailList
@inject List<ParameterEntity> parameterEntityList
@inject CommentTool commentTool
@inject WorkFlowInfo workFlowInfo
@inject WorkFlowTool _WorkFlowTool
@inject DataManager _DataManager
<body>
    <h1>WorkFlowDetail-@workFlowInfo.WorkFlowName</h1>
    <br>
    <table class="table">
        <thead>
            <tr>
                <th>Sno</th>
                <th>ID</th>
                <th>StepID</th>
                <th>StepName</th>
                <th>User</th>
                <th>Status</th>
                <th>Message</th>
                <th>CreateTime</th>
                <th>CompleteTime</th>
                <th>Parameter</th>
            </tr>
        </thead>
        <tbody>
            @if (workFlowDetailList != null)
                @for (var i = 0; i < workFlowDetailList.Count; i++)
                {
                    WorkFlowDetail workFlowDetail = workFlowDetailList[i];
                    <tr>
                        <td>@(i+1)</td>
                        <td>@workFlowDetail.ID</td>
                        <td>@workFlowDetail.StepID</td>
                        @if (@workFlowDetail.Type == 3)
                        {
                            <td><a href="Detail/@workFlowDetail.SubProcessMainID" target="_SubprocessDetail">@workFlowDetail.StepName</a></td>
                        }
                        else
                        {
                            <td>@workFlowDetail.StepName</td>
                        }
                        <td>@workFlowDetail.User</td>
                        <td>@workFlowDetail.StatusStr</td>
                        <td>@workFlowDetail.Message</td>
                        <td>@workFlowDetail.CreateTime</td>
                        <td>@workFlowDetail.CompleteTime</td>
                        <td><a @onclick="()=>SearchParaters(workFlowDetail.ID)" href="" data-toggle="modal" data-target="#Paramerters">Parameters</a></td>
                    </tr>
                }
        </tbody>
    </table>
     
    <div class="modal fade" id="Paramerters" tabindex="-1" role="dialog" aria-labelledby="ParamertersLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="title">Business Parameters</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                </div>
                <div class="model-body">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>Sno</th>
                                @*<th>ID</th>*@
                                <th>Name</th>
                                <th>Value</th>
                            </tr>
                        </thead>
                        <tbody>
                            @if (parameterEntityList != null)
                                @for (var i = 0; i < parameterEntityList.Count; i++)
                                {
                                    ParameterEntity parameterEntity = parameterEntityList[i];
                                    <tr>
                                        <td>@(i+1)</td>
                                        @*<td>@parameterEntity.ID</td>*@
                                        <td>@parameterEntity.Name</td>
                                        <td>@parameterEntity.Value</td>
                                    </tr>
                                }
                        </tbody>
                    </table>
                </div>
                <div class="modal-footer">
@*                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save</button>*@
                </div>
            </div>

        </div>
    </div>
</body>
